{% extends 'base.html' %}
{% block title %}{{ title }}{% endblock %}
{% block content %}
<div class="container mt-4">
    <div class="card shadow-sm">
        <div class="card-header bg-primary text-white d-flex justify-content-between align-items-center">
            <h5 class="mb-0"><i class="bi bi-people me-2"></i>{{ classname }} 学生列表</h5>
            <a href="{% url 'core:student_create' %}" class="btn btn-light btn-sm">
                <i class="bi bi-plus-circle me-2"></i>添加学生
            </a>
        </div>
        <div class="card-body">
            {% if late_list %}
            <div class="table-responsive">
                <table class="table table-hover table-striped">
                    <thead class="table-light">
                        <tr>
                            <th>姓名</th>
                            <th>学号</th>
                            <th>性别</th>
                            <th>年龄</th>
                            <th>联系方式</th>
                            <th>家庭住址</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for student in late_list %}
                        <tr>
                            <td>{{ student.name }}</td>
                            <td>{{ student.id|default:'-' }}</td>
                            <td>{{ student.gender_display }}</td>
                            <td>{{ student.age }}</td>
                            <td>{{ student.contact_info|default:'-' }}</td>
                            <td>{{ student.home_address|default:'-' }}</td>
                            <td>
                                <div class="btn-group btn-group-sm">
                                    <a href="{% url 'core:student_update' student.student_id %}" class="btn btn-outline-primary">
                                        <i class="bi bi-pencil me-1"></i>编辑
                                    </a>
                                    <a href="{% url 'core:student_delete' student.student_id %}" class="btn btn-outline-danger">
                                        <i class="bi bi-trash me-1"></i>删除
                                    </a>
                                </div>
                            </td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
            {% else %}
            <div class="text-center py-5">
                <i class="bi bi-inbox fs-1 text-muted mb-3"></i>
                <p class="text-muted">暂无学生记录</p>
            </div>
            {% endif %}
        </div>
    </div>
</div>
{% endblock %}